package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.NursingProjectService;
import com.zzyl.service.OrdersService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.naming.Name;

/**
 * @Description CustomerOrdersController
 * @Author apeng
 * @Date 2024-10-21
 */
@RestController
@RequestMapping("/customer/orders")
@Api(tags = "用户端护理项目")
public class CustomerOrdersController extends BaseController {

    @Autowired
    private OrdersService ordersService;

    @Autowired
    private NursingProjectService nursingProjectService;

    @GetMapping("/project/page")
    @ApiOperation("分页查询列表")
    public ResponseResult<PageResponse> page(@ApiParam("护理项目名称") String name,
                                             @ApiParam("页码")
                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                             @ApiParam("每页大小")
                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                             @ApiParam("状态") Integer status) {
        PageResponse pageResponse = ordersService.page(name,pageNum,pageSize,status);
        return success(pageResponse);
    }


    //查询护理项目信息
    @GetMapping("/project/{id}")
    @ApiOperation("根据id查询护理项目信息")
    public ResponseResult<NursingProjectVo> findProjectGetById(@PathVariable Long id){

        return success(nursingProjectService.getById(id));
    }
}
